2 # A mass m is subject to a force F=-k*r.
3 # What is the trajectory if the mass starts at position (a,0,0)?
4 # How much time does it take to pass through zero?
5 # What is the trajectory if it starts at (a,0,0) with velocity (0,v0,0)?
6 # Compare to the case including gravity on earth in x direction
8 # m*y'' = -k*y (z can be set to 0).
10 coefficient.1(-1) -> -a # (a,0,0), has to be negative because x' is negative
11 coefficient.2 -> k/m_x # k/m for x
12 coefficient.3(+1) -> v0 # (0,v0,0), has to be positive because y'' is positive
13 coefficient.4 -> k/m_y # k/m for y, identical to k/m for x
14 coefficient.5(-1) -> -g # g
19 cmultiply (k/m_x, x) -> k/m*x
20 isum (k/m*x, -g) -> -k/m*x+g
21 assign (-k/m*x+g) -> x''
26 cmultiply (k/m_y, y) -> k/m*y
27 invert (k/m*y) -> -k/m*y
28 assign (-k/m*y) -> y''